import requests
import json
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36'
}
# translate = input('请输入要翻译内容：')
data = {
    'from':'en',
    'to':'zh',
    'query':'dog',
    'simple_means_flag':'3',
    'sign':'871501.634748',
    'token':'0601deff9d7b3b0c0c2417226e8e74c8',
    'domain':'common'
}
url = 'https://fanyi.baidu.com/v2transapi?from=en&to=zh'

response = requests.post(url=url,data=data,headers=headers)
result = response.json()
fp = open('./dog.json','w',encoding='utf-8')
json.dump(result,fp=fp,ensure_ascii=False)
print('over!')